<template>
	<view class="page" :style="'height:' + height + 'rpx'">
		<view style="width: 100%;">
			<view class="item" @click="toAgree(item)" v-for="(item,index) in list" :key="index">
				<view class="text">
					<view class="title">
						<text style="font-weight: 700; color:#4D4D4D;">
							{{item.mainerName}}
						</text>
						
						<text style="margin-left: 10rpx;">
							邀请你加入
						</text>
						<!-- <br/> -->
						<text style="font-weight: 700; color:#4D4D4D;">
							{{item.orgName}}
						</text>
						<text>
							无课时间一览表.xls
						</text>
					</view>
					<br />
					<text style="color:#23b8ff;font-weight: 700;text-align: right;"v-if="item.status == 0" > 点击请前往加入</text>
				</view>
				<view class="type" v-if="item.status == 1" style="background-color: #7CCD7C">
					已同意
				</view>
				<view class="type" v-else-if="item.status == 2" style="background-color: #EE5C42">
					已拒绝
				</view>
				<view class="shadow" v-if="item.status != 0" ></view>
			</view>
		</view>
		<view class="noDataTip" v-if="list.length == 0">
			<view class="iconfont icon-wuanpai" style="color:#6B6B6B;margin-right: 25rpx;font-size: 45rpx;"></view>
			<view style="font-size: 45rpx;">暂无邀请数据!</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad() {
			let that = this;
			uni.getSystemInfo({
				success: function(res) {
					let pxToRpxScale = 750 / res.windowWidth;
					that.height = res.windowHeight * pxToRpxScale;
				}
			})
			this.header.Authority = uni.getStorageSync('Authority');
			
		},
		onShow() {
			this.getInvisitMe()
		},
		data() {
			return {
				height: 0,
				header: {
					Authority: ''
				},
				list: []
			}
		},
		methods: {
			toAgree(item) {
				// console.log(item)
				if (item.status == 0) {
					let data = JSON.stringify(item);
					uni.navigateTo({
						url: '../toAgree/toAgree?data=' + data
					})
				}
			},
			async getInvisitMe() {
				uni.showLoading({
					title: '加载中..',
					mask: true
				})
				let res = await getApp().UniRequest("/timeoff/authority/getMyInvited", "Get", "",
					this.header);
				console.log(res, '邀请我的');
				if (res.code === 20000) {
					// console.log(res.data.data)
					this.list = res.data.data;
					uni.hideLoading()
				}
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	$willSure: #EEAD0E; //待确定
	$sure: #90EE90; //已确定
	$payed: #23b8ff; //已支付
	$reject: #EE3B3B; //被拒绝

	.page {
		background-color: #f8f8f8;
		padding-top: 20rpx;
		padding: 20rpx 20rpx 0rpx 10rpx;
		.noDataTip {
			height: 150rpx;
			width: 650rpx;
			line-height: 50rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			position: absolute;
			top: 50%;
			margin-top: -150rpx;
			left: 50%;
			margin-left: -325rpx;
			font-size: 50rpx;
			color: #6B6B6B;
			// background-color: #fff;
			// box-shadow: 0.5rpx 0.5rpx 40rpx #DBDBDB;
			border-radius: 20rpx;
		}

		.item {
			width: 96%;
			height: 180rpx;
			position: relative;
			margin: 0 auto;
			margin-bottom: 20rpx;
			background-color: #fff;
			box-shadow: 0.1rpx 0.1rpx 10rpx #D9D9D9;
			border-radius: 10rpx;
			
			.text {
				width: 96%;
				height: 100%;
				padding: 10rpx 0rpx 10rpx 20rpx;
				letter-spacing: 4rpx;
				line-height: 50rpx;
				display: flex;
				flex-direction: column;
				justify-content: center;
				// align-items: center;
				.title {
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					overflow: hidden;
					-webkit-box-orient: vertical;
					// font-weight: 700;
					color: #4D4D4D;
				}

				// display: flex;

			}

			.type {
				position: absolute;
				right: -26rpx;
				top: 10rpx;
				background-color: #EEAD0E;
				color: #fff;
				width: 80rpx;
				height: 40rpx;
				line-height: 40rpx;
				text-align: center;
				font-size: 20rpx;
				letter-spacing: 2rpx;
			}

			.shadow {
				// z-index: ;
				position: absolute;
				right: -23rpx;
				top: 56rpx;
				// left: 20rpx;
				border: 12rpx solid #E0E0E0;
				border-right: 12rpx solid transparent;
				border-bottom: 12rpx solid transparent;
				width: 0;
				height: 0;
			}
		}
	}
</style>
